package cn.z2huo.knowledge.basic.datetime.newtime;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;

/**
 * <p>
 *
 * @author z2huo
 */
public class Main {

    private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS");

    private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSSSS");

    public static void main(String[] args) throws ParseException {
        String dateTimeStr = "2024-02-02";

//        LocalDateTime dateTime = LocalDateTime.parse(dateTimeStr, formatter);
//        System.out.println(dateTime);

//        Date date = dateFormat.parse(dateTimeStr);
//        System.out.println(date);

        DateTime dateTime = DateUtil.parse(dateTimeStr);
        System.out.println(DateUtil.parse("2024-02-02"));
        System.out.println(DateUtil.parse("2024-02-02 00:00:00"));
        System.out.println(DateUtil.parse("2024-02-02 12:12:11.222333"));
    }
}
